<template>
  <div class="wrap" style="background-color: #e9ecef;">
    <div class="box">
      <img style="width: 300px; height: 300px" src="../assets/result.png">
      <div class="text">提交成功！感谢您的参与！</div>
      <el-button type="primary" @click="returnHome">返回主页</el-button>
      <el-button v-if="this.type === 'vote' " type="primary" @click="toVoteResult">查看投票结果</el-button>
      <el-button v-if="this.type === 'exam' " type="primary" @click="toAnswer">查看答案</el-button>
    </div>
  </div>
</template>

<script>
export default {
  name: "Result",
  props: {
    QID64: {
      default: -1
    },
    TYPE: {
      default: "normal"
    }
  },
  data() {
    return {
      type: this.TYPE
    };
  },
  methods: {
    returnHome() {
      this.$router.replace("/");
    },
    toVoteResult() {
      this.$router.replace({ path: "/voteResult/" + this.QID64 });
    },
    toAnswer() {
      this.$router.replace({ path: "/correctAnswer/" + this.QID64 });
    }
  }
};
</script>

<style scoped>
.wrap {
  height: calc(100% - 80px);
  display: flex;
  justify-content: center;
  padding-top: 80px;
}
.box {
  width: 500px;
  background-color: white;
  height: 420px;
  border-radius: 20px;
}
.text {
  margin: 10px auto;
  font-size: 20px;
  font-weight: 900;
  padding-left: 15px;
}
</style>